import Vue from 'vue'
//自定义指令js文件
Vue.directive('num', {
    bind(el) {
    },
    inserted(el) {
        el.oninput = function () {
            if (isNaN(el.value) == true) {
                el.value = el.value.slice(0, -1)
            }
        }
    },
    update(el) {
    }
})
Vue.directive('mov', {
    bind(el) {
    },
    inserted(el,n) {       
        console.log(n.value);
        el.onmousedown = function (e) {
            var x = e.clientX
            var y = e.clientY
            el.onmousemove = function (e) {
                el.style.marginLeft = e.clientX - x + "px"
                el.style.marginTop = e.clientY - y + "px"
            }
        },
        el.onmouseup=function(e){
            el.onmouseover=null
        }
    },
    update(el,b) {
        console.log("update");
    }
})